package cn.lopr.im.android.mvp.view.adapters.base;

import java.util.Comparator;
import java.util.Date;

import cn.lopr.im.android.db.entity.HomeDialogue;

public class DateComparator implements Comparator<HomeDialogue> {

    @Override
    public int compare(HomeDialogue homeDialogue, HomeDialogue t1) {
        Date d1 = homeDialogue.getLastUpdate();
        Date d2 = t1.getLastUpdate();

        if (d1.before(d2)) {
            return 1;
        } else if (d1.after(d2)) {
            return -1;
        } else {
            return 0;
        }
    }
}
